import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import tailwindcss from "tailwindcss";
import { UnifiedViteWeappTailwindcssPlugin as uvwt } from 'weapp-tailwindcss/vite';

const webappTailwindcssDiasabledPlatform = ["h5", "app"];
const platform: string = process.env.UNI_PLATFORM || "";
const isDisabled = webappTailwindcssDiasabledPlatform.includes(platform);
console.log(platform, "vite platfrom");
console.log(isDisabled, "vite isDisabled");

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [uni(), uvwt({
    // ...other-options
    rem2rpx: true,
    disabled: isDisabled
  })],
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: `@import "@/static/css/qujia.common.scss";`
      }
    },
    postcss: {
      plugins: [
        tailwindcss()
      ]
    }
  }
});
